Energy Conservation in a Pendulum Simulation